package com.matrix.lbs.model;

import com.matrix.common.enums.ShopStatusEnum;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import org.springframework.data.elasticsearch.core.suggest.Completion;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author 有点甜
 * @since 2025/7/25
 */
@Data
@Document(indexName = "matrix_shops")
public class ShopLocationDoc {

    @Id
    @Field(type = FieldType.Keyword)
    private String id;

    @Field(type = FieldType.Long)
    private Long shopId;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String shopName;

    @CompletionField(maxInputLength = 100)
    private Completion shopNameSuggest;

    @Field(type = FieldType.Keyword, index = false)
    private String logoUrl;

    @Field(type = FieldType.Double)
    private BigDecimal rating;

    @Field(type = FieldType.Double)
    private BigDecimal avgConsumption;

    @Field(type = FieldType.Integer)
    private ShopStatusEnum status;

    @GeoPointField
    private GeoPoint location;

    @Field(type = FieldType.Integer)
    private Integer monthlySales;

    @Field(type = FieldType.Date, format = DateFormat.date_optional_time)
    private Date createTime;

    @Field(type = FieldType.Date, format = DateFormat.epoch_millis)
    private Date updateTime;
}
